//
//  ZHParentTableController.swift
//  ZHPageView
//
//  Created by Rango on 2020/9/2.
//  Copyright © 2020 Rango. All rights reserved.
//

import UIKit

class ZHParentTableController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch indexPath.section {
        case 0: // 无指示器
            skip(with: 0, indexPath: indexPath)
        case 1: // 指示器样式
            skip(with: 100, indexPath: indexPath)
            break
        case 2: // 自定义 item
            skip(with: 200, indexPath: indexPath)
            break
        case 3:
            skip(with: 300, indexPath: indexPath)
        default:
            break
        }
    }
    
    func skip(with tag: Int, indexPath: IndexPath) {
        let vc = ZHParentController()
        vc.segmentIndex = tag + indexPath.row
        vc.navigationItem.title = tableView.cellForRow(at: indexPath)?.textLabel?.text
        navigationController?.pushViewController(vc, animated: true)
    }
}
